package com.yanyeori.leetcode;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import org.junit.Test;

/**
 * @author chenkuan 2023/11/17
 */
public class Tests {

    public static void main(String[] args) {
        System.out.println((-4 % 256));
    }

    @Test
    public void findMin() {
        int[] nums = {3,4,5,1,2};
        System.out.println(new TopInterview150().findMin(nums));
    }

    @Test
    public void climbStairs() {
        System.out.println(new TopInterview150().climbStairs(5));
    }

    @Test
    public void rob1() {
        System.out.println(new TopInterview150().rob1(new int[]{1,2,3,1}));
    }

    @Test
    public void wordBreak() {
        long start = System.currentTimeMillis();
        System.out.println(new TopInterview150().wordBreak("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab", CollUtil.toList("a","aa","aaa","aaaa","aaaaa","aaaaaa","aaaaaaa","aaaaaaaa","aaaaaaaaa","aaaaaaaaaa")));
        System.out.println(System.currentTimeMillis() - start);
    }

    @Test
    public void sortList() {
        TopInterview150.ListNode res = new TopInterview150().sortList(new TopInterview150.ListNode(4, new TopInterview150.ListNode(2, new TopInterview150.ListNode(1, new TopInterview150.ListNode(3)))));
        System.out.println(JSONUtil.toJsonStr(res));
    }

    @Test
    public void construct() {
        TopInterview150.QuadNode res = new TopInterview150().construct(new int[][]{{0, 1}, {1, 0}});
        System.out.println(JSONUtil.toJsonStr(res));
    }

    @Test
    public void removeDuplicates1() {
        int res = new TopInterview150().removeDuplicates1(new int[]{1,1,1,2,2,3});
        System.out.println(res);
    }

    @Test
    public void removeDuplicates2() {
        int res = new TopInterview150().removeDuplicates2(new int[]{1,1,1,2,2,3});
        System.out.println(res);
    }

    @Test
    public void canCompleteCircuit() {
        int res = new TopInterview150().canCompleteCircuit(new int[]{1,2,3,4,5}, new int[]{3,4,5,1,2});
        System.out.println(res);
    }

    @Test
    public void moveZeroes() {
        new HotTop100().moveZeroes(new int[]{0,1,0,3,12});
    }

    @Test
    public void lengthOfLongestSubstring() {
        new HotTop100().lengthOfLongestSubstring("abcabcbb");
    }

    @Test
    public void findAnagrams() {
        new HotTop100().findAnagrams("cbaebabacd", "abc");
    }
}
